<?php
class CALIX_Loader extends CI_Loader
{
	public function ar($model, $db_conn = FALSE)
	{
		if ($model == ''){
			return NULL;
		}	
		$path = '';
		if (($last_slash = strrpos($model, '/')) !== FALSE){
			$path = substr($model, 0, $last_slash + 1);
			$model = substr($model, $last_slash + 1);
		}
		$CI =& get_instance();
		$model = strtolower($model);
		foreach ($this->_ci_model_paths as $mod_path)
		{
			if ( ! file_exists($mod_path.'models/'.$path.$model.'.php')){
				continue;
			}
	
			if ( ! class_exists('CI_Model')){
				load_class('Model', 'core');
			}
	
			require_once($mod_path.'models/'.$path.$model.'.php');
	
			$model = ucfirst($model);
	
			$model_obj = new $model();
			$model_obj->init();
			return $model_obj;
		}
		show_error('Unable to locate the model you have specified: '.$model);
	}
}